Networking

This week I started working with the ESP32 chip in order to work on connecting my boards to the internet. This week I started off by following a couple tutorials. Many were found through Yuval's great website. These were a great introduction to using the ESP32 chip and firebase.

Firebase

Firebase is a set of hosting services for any type of application. It offers NoSQL and real-time hosting of databases, content, social authentication, and notifications, or services, such as a real-time communication server. I am able to send data from the ESP32 to firebase as well as read the firebase from the ESP32. Setting up the firebase database:
  1. Go to firebase
  2. Create an account
  3. Create a new project
  4. Go to Authentication
  5. Click get started
  6. Use Email and Password
  7. Go to realtime database
  8. Create realtime database
  9. Choose test mode, can change later
  10. Save the URL
  11. Go to project settings
  12. Save Web API Key
  13. Now its time to start coding in Arduino

Starting to code in Arduino:
  1. Go to Manage Libraries
  2. Install Firebase Arduino Client Library for ESP8266 and ESP32 by Mobitz
  3. In the code make sure to include the libraries for Wifi and Firebase_ESP_Client
  4. When inputing wifi SSID and password, computer must be on the same internet, Harvard Wifi does not work
  5. Then set your API Key and Database URL which we copied before

Sending data: Set Function Then using the set function, we can set a specific path in our firebase database to an int, float, double, string, JSON, array, blob, or file.
The specific path in the database is important because when we are trying to get the data from the database we need to use that same path.
I am also able to create a web app that displays the numbers on a URL.
Recieivng data: Get Function
The get function, we can get the int, float, double, string, JSON, array, blob, or file from a specific path in the database by using the get functions. I am able to send data to a web app through firebase so from that I know I will be able to get data from a web app through firebase. I will be making a web app that activates an LED attached to my development board. Guide to set up web app Now you can open up the project and if you want to check it out you go back to terminal and type firebase deploy.
Now we use this file to code the web app. By changing the body you can get the html to do as you like. Then by working with the javascript by using the script tag you are able to connect to firebase and change the specific path that we set the buttons to change.

Link to the webpage
With ESP32: I set the wifi, and firebase authentication and host. Then set up the strings which we are looking for on firebase. Then we start looking towards the path which we set to have the information. With HTML and Javascript: I set the path which to store the data. Then I made buttons which will change the data in the database. The ESP32 board will then read the database and change accordingly.

Resources for this week